import 'dart:collection';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'package:get/get.dart';

import '../../../const/AppConstUrl.dart';
import '../../../nets/NetWorkManager.dart';
import '../../../routes/app_pages.dart';
import '../../../style/app_colors.dart';
import '../../../widget/CustomAppBottomBar.dart';
import '../controllers/reading_company_controller.dart';

class ReadingCompanyView extends GetView<ReadingCompanyController> {
  const ReadingCompanyView({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('绘本伴读'),
        centerTitle: true,
        leading: IconButton(
          icon: Image.asset('assets/images/ic_back2.png',width: 48.w,height: 48.h),
          onPressed: () {
            Get.back();
          },
          tooltip: MaterialLocalizations.of(context).backButtonTooltip, // 可选：设置工具提示
        ),
        bottom: CustomAppBottomBar('手机网络连接中断')
      ),
      body: ListView(
        children: [
          SizedBox(height: 234.h),
          Container(
            margin: EdgeInsets.symmetric(horizontal: 60.h),
            child: Image.asset('assets/images/img_reading.webp',width: 630.w,height: 500.h),
          ),
          SizedBox(height: 60.h),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
                Column(
                  children: [
                    RichText(
                      text: TextSpan(
                          children: [
                            TextSpan(text: '悟空可以识别',style: TextStyle(fontSize: 30.sp,color: AppColors.Page_Title_Color)),
                            TextSpan(text: '纸质文本',style:  TextStyle(fontSize: 30.sp,color: AppColors.FONT_HIGH_LIGHT_COLOR_CHARACTERS),)

                          ]
                      ),
                    ),

                    Text('在“查询可读绘本”页面搜索书名，',style: TextStyle(fontSize: 30.sp,color: AppColors.Page_Title_Color)),
                    RichText(
                      text: TextSpan(
                          children: [
                            TextSpan(text: '确认搜索结果的',style: TextStyle(fontSize: 30.sp,color: AppColors.Page_Title_Color)),
                            TextSpan(text: '封面',style:  TextStyle(fontSize: 30.sp,color: AppColors.FONT_HIGH_LIGHT_COLOR_CHARACTERS),),
                            TextSpan(text: '是否和手上书籍一致',style: TextStyle(fontSize: 30.sp,color: AppColors.Page_Title_Color)),

                          ]
                      ),
                    ),
                    SizedBox(height: 227.h,),
                    Container(
                      width: 594.w,
                      child: ElevatedButton(onPressed: () {
                        //Tips.showToast('jumping ...');
                        onToReadingWebViewPageTask();
                      }, child: Text('查询可阅读绘本',style: TextStyle(fontSize: 32.sp),)),
                    )
                  ],
                )


            ],
          )

        ],
      ),
    );
  }

  Future<void> onToReadingWebViewPageTask() async {
    Map<String, String> param = HashMap();
    param["title"] = "绘本查询";
    param["url"] =  NetWorkManager.mServerHost+AppConstUrl.READING_COMPANY_HOST_URL;
    Get.toNamed(Routes.WEBVIEW, parameters: param);
  }

}
